package com.you.nettty.rpc.proxy;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * 远程调用代理类Handler
 */
public class RpcProxyHandler extends ChannelInboundHandlerAdapter {
    private Object respResult;

    public Object getRespResult() {
        return this.respResult;
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        respResult = msg;
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
        System.out.println("-----client exception is: " + cause.getMessage());
    }
}
